
package edu.tongji.jiaowu.dao.jdbc;
 
import java.util.List;

import edu.tongji.jiaowu.dao.OriginalScoreCourseDao;
import com.tongji.quickCRUDQ.define.Row;
import com.tongji.quickCRUDQ.model.CommonBean;
import com.tongji.quickCRUDQ.dao.jdbc.BaseDaoJdbc;

public class OriginalScoreCourseDaoJdbc extends BaseDaoJdbc implements OriginalScoreCourseDao {
	String tableName="T_ORIGINAL_SCORE_COURSE";
	String beanName="originalScoreCourse";
	
	public CommonBean createOriginalScoreCourse(){
		CommonBean originalScoreCourses=this.createBean(tableName,beanName);
                return originalScoreCourses;		
	}
	
/*
	public CommonBean findOriginalScoreCourses(String refid) {
		CommonBean originalScoreCourses=this.createOriginalScoreCourse();
		String sql="select * from T_ORIGINAL_SCORE_COURSE where refid=?";
		List data=this.getCommonDao().select(sql,new String[]{refid});
		originalScoreCourses.addData(data);
                return originalScoreCourses;
       }
*/
	public CommonBean findOriginalScoreCourseById(String id) {
		CommonBean originalScoreCourses=this.createOriginalScoreCourse();
		String sql="select * from T_ORIGINAL_SCORE_COURSE where id=?";
		List data=this.getCommonDao().select(sql,new String[]{id});
		originalScoreCourses.addData(data);
    return originalScoreCourses;
  }
  
	public CommonBean findAllOriginalScoreCourses() {
		CommonBean originalScoreCourses=this.createOriginalScoreCourse();
		String sql="select * from T_ORIGINAL_SCORE_COURSE ";
		List data=this.getCommonDao().select(sql,new String[]{});
		originalScoreCourses.addData(data);
    return originalScoreCourses;
  }
	public void insertOriginalScoreCourse(CommonBean originalScoreCourseBean){
		List data=originalScoreCourseBean.getData();
		Row row=this.getRow(tableName);
		this.getCommonDao().templateBatchInsert(row,data,this.getIdGenerator());
	}

	public void updateOriginalScoreCourse(String status, String id) {
		String sql="update t_original_score_course set status=? ,entry_date=GETDATE() where id=?";
		getCommonDao().updateRecord(sql, new Object[]{status,id});
	}
}

